﻿using Blm.Utils.Extensions;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using VisionCloud.Domain.Common;
using VisionCloud.Domain.DtoModel.Rs;
using VisionCloud.Domain.Repository.Interface.Rs;

namespace VisionCloud.Service.Rs
{
    public class RsWorkOrderService
    {
        public IRsWorkOrderRepository RsWorkOrderRepository { get; set; }

        /// <summary>
        /// 分页获取工单列表
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task<ApiPageResult> GetPage(WorkOrderListRequestDto dto)
        {
            var isAdmin = OperatorProvider.Get().RoleNameList.Contains("公司管理员");
            if(!isAdmin)
                return dto.CopyTo<ApiPageResult>();
            return await RsWorkOrderRepository.GetPage(dto);
        }
    }
}
